home *** CD-ROM | disk | FTP | other *** search
/ Megahits 7 / Megahits 7 (1995)(GTI - Rhein-Main-Soft)(DE)[!].iso / franz / franz_101_150 / franz_130.dms / franz_130.adf / PLTTools / PLTHear / PLTHear.asm < prev    next >
Assembly Source File  |  1991-06-22  |  36KB  |  1,640 lines

  1.  
  2. ; ***********************************************************
  3. ; *                                                         *
  4. ; *    P L A T I N U M - H E A R - R E P L A C E M E N T    *
  5. ; *                                                         *
  6. ; *                        V 1.00                           *
  7. ; *                                                         *
  8. ; ***********************************************************
  9. ; *                                                         *
  10. ; *          Assembler-Source / Assembler: Devpac II        *
  11. ; *                                                         *
  12. ; *                    (C)April 1991 by                     *
  13. ; *                                                         *
  14. ; *                    Joerg Schliesser                     *
  15. ; *                  Platinum-Softwareline                  *
  16. ; *                   Rotenwaldstrasse 20                   *
  17. ; *                   D-7000 Stuttgart 1                    *
  18. ; *                         Germany                         *
  19. ; *                                                         *
  20. ; ***********************************************************
  21.  
  22. ; *** Amiga OS-Routinen ***
  23.  
  24.     ; Exec-Library
  25. AllocMem    =    -198
  26. FreeMem        =    -210
  27. FindTask    =    -294
  28. GetMsg        =    -372
  29. ReplyMsg    =    -378
  30. WaitPort    =    -384
  31. CloseLibrary    =    -414
  32. OpenLibrary    =    -552
  33.  
  34.     ; Dos-Library
  35. Open        =    -30
  36. Close        =    -36
  37. Read        =    -42
  38. Lock        =    -84
  39. UnLock        =    -90
  40. DupLock        =    -96
  41. Examine        =    -102
  42. CurrentDir    =    -126
  43. Delay        =    -198
  44.  
  45.     ; Intuition-Library
  46. AddGadget    =    -42
  47. ClearPointer    =    -60
  48. CloseWindow    =    -72
  49. OpenWindow    =    -204
  50. PrintIText    =    -216
  51. RefreshGadgets    =    -222
  52. RemoveGadget    =    -228
  53. SetPointer    =    -270
  54.  
  55.     ; Graphics-Library
  56. RectFill    =    -306
  57. SetAPen        =    -342
  58. ScrollRaster    =    -396
  59.  
  60.     ; Hardware-register
  61.  
  62. dmacon = $dff096    ; DMA
  63. cialed = $bfe001    ; low-pass-filter on/off
  64. audxadr    = $DFF0A0    ; base-adress of 1st channel
  65. audxlch    = $0        ; offset for adress of sample-data
  66. audxlen    = $4        ; offset for length of sample
  67. audxper    = $6        ; offset for sampleperiod
  68. audxvol    = $8        ; offset for volume
  69. aud0vol = $dff0a8
  70. aud1vol = $dff0b8    ; registers for volumes of
  71. aud2vol = $dff0c8    ; the four voices
  72. aud3vol = $dff0d8
  73.  
  74. ; assembler-options
  75.  
  76.     section    programm,code    ;1st section, code, public_mem
  77.  
  78. ; check WB- or CLI-start and get  WB-startup-message
  79.  
  80. start:
  81.     move.l    sp,startsp    ;save stackpointer 
  82.     move.l    a0,memo1    ;cli textpointer
  83.     move.w    d0,memo2    ;cli textlength
  84.     move.l    4,a6
  85.     suba.l    a1,a1        ;get adress of PLTHear-Task
  86.     jsr    FindTask(a6)
  87.     move.l    d0,thistask
  88.  
  89.     lea    dosname,a1
  90.     moveq    #0,d0
  91.     jsr    OpenLibrary(a6)    ;open dos_lib
  92.     move.l    d0,dosbase
  93.     beq    quitplthear
  94.  
  95.     lea    graphname,a1
  96.     moveq    #0,d0
  97.     jsr    OpenLibrary(a6)    ;open graph_lib
  98.     move.l    d0,graphbase
  99.     beq    quitplthear
  100.  
  101.     lea    intuiname,a1
  102.     moveq    #0,d0
  103.     jsr    OpenLibrary(a6)    ;open intui_lib
  104.     move.l    d0,intuibase
  105.     beq    quitplthear
  106.  
  107.     move.l    #1024,d0
  108.     move.l    #$10003,d1
  109.     jsr    AllocMem(a6)    ;get infomem (for fileinfos)
  110.     move.l    d0,infomem
  111.     beq    quitplthear
  112.  
  113.     move.l    thistask,a4    ;pointer to task struct
  114.     tst.l    $ac(a4)        ;started from CLI ?
  115.     beq    wbstart
  116.  
  117. ; get filename if started from CLI
  118.  
  119.     move.l    memo1,a0    ;text-pointer
  120.     move.w    memo2,d0    ;text-length
  121.     subq.w  #1,d0        ;no text ?
  122.     beq    nofile        ;well then ... waiting
  123. lforname:
  124.     cmpi.b    #$20,(a0)+    ;look for 'space'
  125.     bne    foundname    ;no space ... got beginning of filename
  126.     dbra    d0,lforname
  127.     bra    nofile        ;no space ... no filename !
  128. foundname:
  129.     subq.l    #1,a0        ;got filename
  130. getfilename:
  131.     lea    filename1,a1    ;adress of memory for filename
  132.     cmp.b    #34,(a0)    ;drop " - char at the beginning
  133.     beq    dropfirst
  134.     cmp.b    #39,(a0)    ;drop ' - char at the beginning
  135.     bne    copyname
  136. dropfirst:
  137.     adda.l    #1,a0
  138. copyname:            ;copy filename
  139.     move.b    (a0)+,d1
  140.     beq    eofname        ;zero => end
  141.     cmp.b    #10,d1
  142.     beq    eofname        ;linefeed => end
  143.     cmp.b    #13,d1
  144.     beq    eofname        ;carriag return => end
  145.     move.b    d1,(a1)+
  146.     bra    copyname
  147. eofname:
  148.     clr.b    (a1)        ;zero-byte to end filename
  149.     move.l    a1,a0        ;keep end of filename
  150.     cmp.b    #34,-(a1)    ;drop " - char at the end
  151.     beq    droplast
  152.     cmp.b    #39,(a1)    ;drop ' - char at the end
  153.     bne    lookparam
  154. droplast:
  155.     clr.b    (a1)
  156. lookparam:
  157.     suba.l    #4,a0 
  158.     cmp.b    #44,(a0)    ;look for ','
  159.     beq    gotparam
  160.     adda.l    #1,a0
  161.     cmp.b    #44,(a0)
  162.     bne    gotfilename    ;no ',' ... no parameter
  163. gotparam:
  164.     move.b    1(a0),d0    ;get type of parameter
  165.     move.b    2(a0),d1    ;get one digit of parameter
  166.     move.b    3(a0),d2    ;get onother digit of the parameter
  167.     clr.b    (a0)+
  168.     clr.b    (a0)+        ;delete paramter from filename
  169.     clr.b    (a0)+
  170.     clr.b    (a0)
  171.     cmp.b    #35,d0        ;look for '#' to indicate repeat-parameter
  172.     beq    gotrepeatparam
  173.     cmp.b    #38,d0        ;look for '&' to indicate time-parameter
  174.     bne    gotfilename
  175. gotrepeatparam:
  176.     move.b    d0,param
  177.     tst.b    d2        ;is there only one digit ?
  178.     bne    twodigits
  179.     sub.b    #48,d1
  180.     move.b    d1,time        ;get value of parameter and save it
  181.     bra    gotfilename
  182. twodigits:
  183.     moveq    #0,d3
  184.     sub.b    #48,d1
  185.     sub.b    #48,d2        ;get value of two-digit parameter
  186.     mulu    #10,d1
  187.     move.b    d1,d3
  188.     add.b    d2,d3        ;and save it
  189.     move.b    d3,time
  190.     bra    gotfilename
  191.  
  192. ; get parameters if programm is started from wb
  193.  
  194. wbstart:
  195.     lea    $5c(a4),a0    ;pointer to task's message-port 
  196.     jsr    Waitport(a6)    ;wait for wb-start-message
  197.     lea    $5c(a4),a0
  198.     jsr    GetMsg(a6)    ;get wb-start-message
  199.     move.l    d0,startmsg
  200.     beq    nofile        ;no message ? ... strange !
  201.     move.l    d0,a0
  202.     cmp.l    #1,$1c(a0)    ;number of arguments < 1 ... nofilename
  203.     bls    nofile
  204.     move.l    $24(a0),a2    ;pointer to list of segments (picked icons)
  205.     beq    nofile        ;... very strange !
  206.     move.l    8(a2),d1    ;pointer to directory of text(?)-icon
  207.     beq    noselectdir
  208.     move.l    dosbase,a6
  209.     jsr    CurrentDir(a6)    ;actual dir => new dir
  210.     move.l    d0,d1
  211.     beq    noselectdir
  212.     jsr    UnLock(a6)
  213. noselectdir:
  214.     move.l    12(a2),d0    ;pointer to filename
  215.     beq    nofile        ;... no filename !
  216.     move.l    d0,a0
  217.     tst.b    (a0)        ;get first character of filename
  218.     beq    nofile        ;... still very strange !
  219.     bra    getfilename    ;well then get the filename
  220.  
  221. ; well ... now we open the window !
  222.  
  223. nofile:
  224.     bset    #0,pltflag
  225. gotfilename:
  226.     move.l    intuibase,a6
  227.     lea    wplt,a0        ;open display-window
  228.     jsr    OpenWindow(a6)
  229.     move.l    d0,wdwhandle    ;keep wdwhandle
  230.     beq    quitplthear
  231.     move.l    d0,a0
  232.     move.l    50(a0),wdwrast    ;keep rastport
  233.     bsr    dowindow    ;draw the wonderful plthear-window
  234.     btst    #0,pltflag
  235.     bne    waitmessage    ;did we get one file to start ?
  236.  
  237. ; now we load our sound (?) - file
  238.  
  239. gotloadfile:
  240.     bsr    pltworkon    ;turn on sleeping-pointer
  241.     move.l    4,a6
  242.     lea    mem,a2        ;get base of memory-pointer-table
  243.     lea    long,a3        ;get base of memery-lengths-table
  244.     moveq    #0,d2        ;get number of channel to load
  245.     move.b    playflag,d2    ;sound-data for
  246.     asl.w    #2,d2
  247.     move.l    0(a2,d2),a1    ;get pointer to corresponding
  248.     move.l    0(a3,d2),d0    ;memory pointer
  249.     beq    nooldsongmem
  250.     jsr    FreeMem(a6)    ;free old data memory
  251.     clr.l    0(a2,d2)
  252.     clr.l    0(a3,d2)
  253. nooldsongmem:
  254.     lea    filename1,a0    ;get filename-pointer
  255.     tst.b    playflag
  256.     beq    gotlfn
  257.     lea    filename2,a0    ;for voice to load
  258.     cmp.b    #1,playflag
  259.     beq    gotlfn
  260.     lea    filename3,a0
  261.     cmp.b    #2,playflag
  262.     beq    gotlfn
  263.     lea    filename4,a0
  264. gotlfn:
  265.     move.l    #$10003,d0    ;type of memory: chip/clear
  266.     bsr    loadfile    ;one file-load-routine
  267.     move.l    d0,0(a3,d2)    ;keep length of data
  268.     beq    loadferror    ;data length = 0 ... really very strange !
  269.     move.l    a0,0(a2,d2)    ;data-adress-pointer
  270.     move.l    #"RAW ",d3
  271.     clr.b    d3
  272.     moveq    #3,d4        ;indicate oneshot-possibility
  273.     moveq    #3,d5        ;indicate repeat-possibility
  274.     cmp.l    #"8SVX",8(a0)    ;look if this is a IFF-8SVX-file
  275.     beq    iffsoundl
  276.     move.l    #8363,d7    ;if not, the set sample-rate and display
  277.     bra    setperiod    ;for raw-sample
  278. iffsoundl:
  279.     lsr.l    #1,d0
  280. lookvhdrl:
  281.     cmp.l    #"VHDR",(a0)    ;look for voice-header-chunk
  282.     beq    foundvhdrl
  283.     adda.l    #2,a0
  284.     subq.l    #1,d0
  285.     bne    lookvhdrl
  286.     move.l    #8363,d7    ;no voice-header-chunk ...
  287.     bra    setperiod    ;that means: one RAW-Sample
  288. foundvhdrl:
  289.     moveq    #0,d7        ;get 8SVX-sample-rate
  290.     move.w    20(a0),d7
  291.     move.l    #"IFF ",d3    ;indicate IFF
  292.     clr.b    d3
  293.     tst.l    8(a0)        ;look if there's a oneshot-part
  294.     bne    onceshow
  295.     moveq    #2,d4
  296. onceshow:
  297.     tst.l    12(a0)        ;look if there's a repeat-part
  298.     bne    setperiod
  299.     moveq    #2,d5
  300. setperiod:
  301.     tst.b    playflag    ;request for voice 1 ?
  302.     bne    nov1lo
  303.     move.l    d3,typ1        ;indicate type of sound (RAW/IFF)
  304.     move.w    d4,ofi1+8    ;indicate oneshot-possibility
  305.     move.w    d5,cofi1+8    ;indicate repeat-possibility
  306.     lea    gdgper1,a3
  307.     lea    period1t,a5    ;get pointers for period-gadgets
  308.     lea    period1,a4
  309.     bra    dosetperiod    ;and redisplay the window
  310. nov1lo:
  311.     cmp.b    #1,playflag    ;request for voice 2 ?
  312.     bne    nov2lo
  313.     move.l    d3,typ2
  314.     move.w    d4,ofi2+8
  315.     move.w    d5,cofi2+8    ;... see above
  316.     lea    gdgper2,a3
  317.     lea    period2t,a5
  318.     lea    period2,a4
  319.     bra    dosetperiod
  320. nov2lo:
  321.     cmp.b    #2,playflag    ;request for voice 3 ?
  322.     bne    nov3lo
  323.     move.l    d3,typ3
  324.     move.w    d4,ofi3+8
  325.     move.w    d5,cofi3+8    ;... see above
  326.     lea    gdgper3,a3
  327.     lea    period3t,a5
  328.     lea    period3,a4
  329.     bra    dosetperiod
  330. nov3lo:
  331.     cmp.b    #3,playflag    ;request for voice 4 ?
  332.     bne    waitmessage
  333.     move.l    d3,typ4
  334.     move.w    d4,ofi4+8
  335.     move.w    d5,cofi4+8    ;... see above
  336.     lea    gdgper4,a3
  337.     lea    period4t,a5
  338.     lea    period4,a4
  339. dosetperiod:
  340.     bsr    modifyperiod    ;modify the period-gadget
  341.     bsr    dowindow    ;the PLTHear-Window
  342.     bsr    pltworkoff
  343.     btst    #0,pltflag
  344.     bne    waitmessage    ;if there's no sound we have to wait
  345.     bset    #0,pltflag
  346.     bra    repeat1        ;if there's a sound... play it !
  347.  
  348. ; modify and redraw a period-gadget
  349.  
  350. modifyperiod:
  351.     move.l    intuibase,a6
  352.     move.l    wdwhandle,a0
  353.     move.l    a3,a1        ;remove the gadget
  354.     jsr    RemoveGadget(a6)
  355.     move.l    d7,(a4)
  356.     move.l    a5,a0
  357.     move.l    d7,d0
  358.     bsr    getascii    ;get ascii-code out of integer
  359.     move.l    wdwhandle,a0
  360.     move.l    a3,a1
  361.     moveq    #-1,d0
  362.     jsr    AddGadget(a6)    ;add the gadget
  363.     lea    gdgquit,a0
  364.     move.l    wdwhandle,a1
  365.     move.l    #0,a2        ;and redraw it
  366.     jsr    RefreshGadgets(a6)
  367.     rts
  368.  
  369. ; waiting for user-action
  370.  
  371. loadferror:
  372.     bsr    pltworkoff
  373. waitmessage:
  374.     tst.b    time
  375.     beq    noparadrive    ;look if there was a parameter
  376.     move.l    dosbase,a6
  377.     cmp.b    #38,param    ;if the 'time' was given go on the
  378.     beq    straighttime    ;easy way
  379.     moveq    #0,d0
  380.     moveq    #0,d1
  381.     moveq    #0,d2        ;if the 'number of repeats' was
  382.     move.w    slength,d2
  383.     asl.w    #1,d2
  384.     move.l    period1,d3    ;requested, try to calculate
  385.     divu    #50,d3
  386.     and.l    #$0000ffff,d3
  387.     move.b    time,d0        ;the right time for the requested
  388.     mulu    d2,d0    
  389.     divu    d3,d0
  390.     move.w    d0,d1        ;repeats
  391.     bra    repeattime        
  392. straighttime:
  393.     moveq    #0,d1
  394.     move.b    time,d1        ;delivered, when the programm was
  395.     mulu    #50,d1
  396. repeattime:
  397.     jsr    Delay(a6)    ;started
  398.     bra    quitplthear
  399. noparadrive:
  400.     move.l    4,a6
  401.     move.l    wdwhandle,a0
  402.     move.l    86(a0),a0    ;window-user-port
  403.     jsr    WaitPort(a6)    ;waiting for intuimessage
  404.     move.l    wdwhandle,a0
  405.     move.l    86(a0),a0    ;window user-port
  406.     jsr    GetMsg(a6)    ;get intuimessage
  407.     tst.l    d0
  408.     beq    waitmessage    ;there wasn't one ... stra...
  409.     move.l    d0,a1
  410.     move.l    20(a1),d6    ;get idcmp-code of event
  411.     move.l    28(a1),a3    ;get (possibly) adress of gadget
  412.     move.w    24(a1),d5    ;get (possibly) raw-key-code    
  413.     move.w    26(a1),d4    ;get (possibly) qualifier
  414.     jsr    ReplyMsg(a6)    ;and reply message
  415.     cmp.l    #$8,d6        ;button-messages only are necessary
  416.     beq    waitmessage    ;for repeating a selected gadget
  417.     cmp.l    #$20,d6
  418.     beq    downgadget    ;immediate-gadget selected ?
  419.     cmp.l    #$40,d6
  420.     bne    noupgadgetmsg    ;wasn't any gadget at all
  421.     cmpa.l    #gdgquit,a3
  422.     beq    quitplthear    ;quit this wonderfull program ?
  423.     cmpa.l    #gdgstop1,a3
  424.     bne    nostop1        ;stop playing voice 1 ?
  425. stopt1:
  426.     bsr    stop1
  427.     bra    waitmessage
  428. stop1:
  429.     move.w    #0,lofi1+8    ;clear 'playing'-indication
  430.     bsr    dowindow    ;redraw the window
  431.     move.w    #0,aud0vol    ;and stop dma for channel 1
  432.     move.w    #1,dmacon
  433.     rts
  434. nostop1:
  435.     cmpa.l    #gdgstop2,a3    ;stop playing voice 2 ?
  436.     bne    nostop2
  437. stopt2:
  438.     bsr    stop2
  439.     bra    waitmessage
  440. stop2:
  441.     move.w    #0,lofi2+8
  442.     bsr    dowindow    ;... see above
  443.     move.w    #0,aud1vol
  444.     move.w    #2,dmacon
  445.     rts
  446. nostop2:
  447.     cmpa.l    #gdgstop3,a3    ;stop playing voice 3 ?
  448.     bne    nostop3
  449. stopt3:
  450.     bsr    stop3
  451.     bra    waitmessage
  452. stop3:
  453.     move.w    #0,lofi3+8
  454.     bsr    dowindow    ;... see above
  455.     move.w    #0,aud2vol
  456.     move.w    #4,dmacon
  457.     rts
  458. nostop3:
  459.     cmpa.l    #gdgstop4,a3    ;stop playing voice 4 ?
  460.     bne    nostop4
  461. stopt4:
  462.     bsr    stop4
  463.     bra    waitmessage
  464. stop4:
  465.     move.w    #0,lofi4+8
  466.     bsr    dowindow    ;... see above
  467.     move.w    #0,aud3vol
  468.     move.w    #8,dmacon
  469.     rts
  470. nostop4:
  471.     cmpa.l    #gdgrep1,a3    ;repeat-request voice 1 ?
  472.     beq    repeat1
  473.     cmpa.l    #gdgrep2,a3    ;... voice 2
  474.     beq    repeat2
  475.     cmpa.l    #gdgrep3,a3    ;... voice 3
  476.     beq    repeat3
  477.     cmpa.l    #gdgrep4,a3    ;... voice 4
  478.     beq    repeat4
  479.     cmpa.l    #gdgonce1,a3    ;once-request voice 1 ?
  480.     beq    playt1
  481.     cmpa.l    #gdgonce2,a3    ;... voice 2
  482.     beq    playt2
  483.     cmpa.l    #gdgonce3,a3    ;... voice 3
  484.     beq    playt3
  485.     cmpa.l    #gdgonce4,a3    ;... voice 4
  486.     beq    playt4
  487.     cmpa.l    #gdgload1,a3    ;load-request voice 1 ?
  488.     beq    load1
  489.     cmpa.l    #gdgload2,a3    ;... voice 2
  490.     beq    load2
  491.     cmpa.l    #gdgload3,a3    ;... voice 3
  492.     beq    load3
  493.     cmpa.l    #gdgload4,a3    ;... voice 4
  494.     beq    load4
  495.     cmpa.l    #gdgfon,a3    ;low-pass-filter on ?
  496.     beq    filton
  497.     cmpa.l    #gdgfoff,a3    ;low-pass-filter off ?
  498.     beq    filtoff
  499.     cmpa.l    #gdghelp,a3    ;request for help-window ?
  500.     bne    waitmessage
  501.     bsr    plthelp        ;draw the help-window
  502.     bra    waitmessage
  503.  
  504. ; do the play-requests
  505.  
  506. repeat1:
  507.     move.w    #3,lofi1+8    ;indicate repeating voice 1
  508.     bsr    dowindow    ;display window
  509.     moveq    #1,d6        ;set flag for repeat
  510.     bra    play1        ;play the sound
  511. repeat2:
  512.     move.w    #3,lofi2+8    ;repeating voice 2
  513.     bsr    dowindow
  514.     moveq    #1,d6
  515.     bra    play2
  516. repeat3:
  517.     move.w    #3,lofi3+8    ;repeating voice 3
  518.     bsr    dowindow
  519.     moveq    #1,d6
  520.     bra    play3
  521. repeat4:
  522.     move.w    #3,lofi4+8    ;repeating voice 4
  523.     bsr    dowindow
  524.     moveq    #1,d6
  525.     bra    play4
  526. playt1:
  527.     moveq    #0,d6        ;once playing voice 1
  528. play1:
  529.     clr.b    playflag
  530.     move.l    period1,doper
  531.     bra    playrequest
  532. playt2:
  533.     moveq    #0,d6        ;once playing voice 2
  534. play2:
  535.     move.b    #1,playflag
  536.     move.l    period2,doper
  537.     bra    playrequest
  538. playt3:
  539.     moveq    #0,d6        ;once playing voice 3
  540. play3:
  541.     move.b    #2,playflag
  542.     move.l    period3,doper
  543.     bra    playrequest
  544. playt4:
  545.     moveq    #0,d6        ;once playing voice 4
  546. play4:
  547.     move.b    #3,playflag
  548.     move.l    period4,doper
  549. playrequest:            ;d6=0=>once, d6=1=>repeat
  550.     moveq    #1,d3        ;d3=0=>IFF, d3=1=>RAW
  551.     moveq    #0,d4
  552.     move.b    playflag,d4
  553.     asl.w    #4,d4
  554.     move.l    #$dff0a0,a4    ;get base-adress of requested voice
  555.     adda.l    d4,a4
  556.     moveq    #0,d0
  557.     move.b    playflag,d0
  558.     moveq    #0,d1
  559.     bset    d0,d1
  560.     move.w    d1,dmacon    ;turn off dma for requested voice
  561.     move.w    #0,audxvol(a4)    ;and clear volume
  562.     move.w    #256,d0
  563. dropwait:            ;waiting, so that dma and volume are
  564.     dbra    d0,dropwait    ;really reseted
  565.     moveq    #0,d7
  566.     move.b    playflag,d7
  567.     asl.w    #2,d7
  568.     lea    mem,a0
  569.     lea    long,a1
  570.     move.l    0(a0,d7),a2    ;get adress and length of
  571.     move.l    0(a1,d7),d2    ;requested sound
  572.     cmp.l    #"8SVX",8(a2)
  573.     bne    doonce        ;if it is a RAW-Sound go to play it
  574.     lsr.l    #1,d2
  575. lookbodyo:
  576.     cmp.l    #"BODY",(a2)    ;look for BODY-chunk
  577.     beq    foundbodyo
  578.     adda.l    #2,a2
  579.     subq.l    #1,d2
  580.     bne    lookbodyo
  581.     move.l    0(a0,d7),a2    ;if there is no bodychunk play
  582.     move.l    0(a1,d7),d2    ;sound as a raw-sample
  583.     bra    doonce
  584. foundbodyo:
  585.     adda.l    #8,a2        ;got begin of oneshot-part 
  586.     move.l    0(a0,d7),a5
  587.     move.l    0(a1,d7),d2
  588.     lsr.l    #1,d2
  589. lookvhdro:
  590.     cmp.l    #"VHDR",(a5)    ;look for VHDR-chunk
  591.     beq    foundvhdro
  592.     adda.l    #2,a5
  593.     subq.l    #1,d2
  594.     bne    lookvhdro
  595.     move.l    0(a0,d7),a2    ;if there is no bodychunk play
  596.     move.l    0(a1,d7),d2    ;sound as a raw-sample
  597.     bra    doonce
  598. foundvhdro:
  599.     moveq    #0,d3        ;set flag for IFF-Sound
  600.     move.l    8(a5),d2    ;get length of oneshot-part
  601.     add.l    12(a5),d2    ;get length of repeat-part
  602. doonce:
  603.     moveq    #0,d4
  604.     move.b    playflag,d4
  605.     asl.w    #4,d4
  606.     move.l    #$dff0a0,a4    ;get base-adress of requested voice
  607.     adda.l    d4,a4
  608.     move.l    a2,audxlch(a4)    ;write begin of sound
  609.     lsr.l    #1,d2
  610.     move.w    d2,audxlen(a4)    ;write length of sound
  611.     move.w    d2,slength
  612.     move.l    #3579546,d0
  613.     move.l    doper,d1
  614.     divu    d1,d0
  615.     move.w    d0,audxper(a4)    ;write playperiod
  616.     moveq    #0,d0
  617.     move.b    playflag,d0
  618.     move.w    #$8200,d1    ;turn on dma
  619.     bset    d0,d1
  620.     move.w    d1,dmacon
  621.     move.w    #64,audxvol(a4)    ;write volume
  622.     move.w    #256,d0
  623. launchwait:            ;wait for dma to be really
  624.     dbra    d0,launchwait    ;started
  625.     tst.b    d6
  626.     beq    oncerequest    ;is there a repeat part to play ?
  627.     tst.b    d3        ;if it is a raw-sample, repeat all
  628.     bne    waitmessage
  629.     move.l    8(a5),d2    ;get oneshot-length
  630.     add.l    d2,a2        ;get adress of repeat-part
  631.     move.l    12(a5),d2    ;get length of repeat-part
  632.     beq    waitmessage
  633.     move.l    a2,audxlch(a4)    ;write adress of repeat-part
  634.     lsr.l    #1,d2
  635.     move.w    d2,audxlen(a4)    ;write length for repeat-part
  636.     move.w    d2,slength
  637.     bra    waitmessage
  638. oncerequest:
  639.     move.l    #notone,audxlch(a4)    ;write adress of 'quiet'-sound
  640.     move.w    #2,audxlen(a4)    ;write length of 'quiet'-sound
  641.     bra    waitmessage
  642.  
  643. ; load a requested sound
  644.  
  645. load1:
  646.     bsr    stop1        ;turn off voice 1 and
  647.     clr.b    playflag    ;load sound
  648.     bra    gotloadfile
  649. load2:
  650.     bsr    stop2        ;load for voice 2
  651.     move.b    #1,playflag
  652.     bra    gotloadfile
  653. load3:
  654.     bsr    stop3        ;load for voice 3
  655.     move.b    #2,playflag
  656.     bra    gotloadfile
  657. load4:
  658.     bsr    stop4        ;load for voice 4
  659.     move.b    #3,playflag
  660.     bra    gotloadfile
  661.  
  662. ; turn on/off hardware low-pass-filter
  663.  
  664. filton:
  665.     bclr    #1,cialed
  666.     bra    waitmessage
  667. filtoff:
  668.     bset    #1,cialed
  669.     bra    waitmessage
  670.  
  671. ; if the user pressed a key ...
  672.  
  673. noupgadgetmsg:
  674.     btst    #0,d4
  675.     bne    shifted        ;was any shift-key pressed too ?
  676.     btst    #1,d4
  677.     bne    shifted
  678.     cmp.w    #$50,d5        ;'F1' - play once voice 1
  679.     beq    playt1
  680.     cmp.w    #$51,d5        ;'F2' - play once voice 2
  681.     beq    playt2
  682.     cmp.w    #$52,d5        ;'F3' - play once voice 3
  683.     beq    playt3
  684.     cmp.w    #$53,d5        ;'F4' - play once voice 4
  685.     beq    playt4
  686.     cmp.w    #$1,d5        ;'1' - repeat voice 1
  687.     beq    repeat1    
  688.     cmp.w    #$2,d5        ;'2' - repeat voice 2
  689.     beq    repeat2    
  690.     cmp.w    #$3,d5        ;'3' - repeat voice 3
  691.     beq    repeat3    
  692.     cmp.w    #$4,d5        ;'4' - repeat voice 4
  693.     beq    repeat4    
  694.     cmp.w    #$3a,d5        ;'-' - turn off filter
  695.     beq    filtoff
  696.     cmp.w    #$0b,d5        ;'-' (US-Keyb) - turn off filter
  697.     beq    filtoff
  698.     cmp.w    #$1b,d5        ;'+' - turn on filter
  699.     beq    filton
  700.     cmp.w    #$0c,d5        ;'+' (US-Keyb) - turn on filter
  701.     beq    filton
  702.     cmp.w    #$45,d5
  703.     beq    quitplthear    ;'esc' - quit programm ?
  704.     cmp.w    #$5f,d5
  705.     bne    waitmessage
  706.     bsr    plthelp        ;'Help' - show help window
  707.     bra    waitmessage
  708. shifted:
  709.     cmp.w    #$50,d5        ;'F1' - load sound for voice 1
  710.     beq    load1
  711.     cmp.w    #$51,d5        ;'F2' - load sound for voice 2
  712.     beq    load2
  713.     cmp.w    #$52,d5        ;'F3' - load sound for voice 3
  714.     beq    load3
  715.     cmp.w    #$53,d5        ;'F4' - load sound for voice 4
  716.     beq    load4
  717.     cmp.w    #$1,d5        ;'1' - turn off voice 1
  718.     beq    stopt1    
  719.     cmp.w    #$2,d5        ;'2' - turn off voice 2
  720.     beq    stopt2    
  721.     cmp.w    #$3,d5        ;'3' - turn off voice 3
  722.     beq    stopt3    
  723.     cmp.w    #$4,d5        ;'4' - turn off voice 4
  724.     beq    stopt4    
  725.     bra    waitmessage
  726.  
  727. ; if the user selected a 'immediate'-gadget
  728.  
  729. downgadget:
  730.     move.l    a3,memo1    ;keep the adress of the gadget
  731. waitdown:
  732.     move.l    memo1,a3
  733.     cmpa.l    #gdgup1,a3    ;increase period of voice 1
  734.     beq    perup1
  735.     cmpa.l    #gdgdn1,a3    ;decrease period of voice 1
  736.     beq    perdn1
  737.     cmpa.l    #gdgup2,a3    ;increase period of voice 2
  738.     beq    perup2
  739.     cmpa.l    #gdgdn2,a3    ;and so on...
  740.     beq    perdn2
  741.     cmpa.l    #gdgup3,a3
  742.     beq    perup3
  743.     cmpa.l    #gdgdn3,a3
  744.     beq    perdn3
  745.     cmpa.l    #gdgup4,a3
  746.     beq    perup4
  747.     cmpa.l    #gdgdn4,a3
  748.     beq    perdn4
  749.     bra    waitmessage
  750.  
  751. ; increasing and decreasing the sampleperiod of a voice
  752.  
  753. perup1:
  754.     clr.b    playflag
  755.     move.l    period1,d7
  756.     cmp.l    #32768,d7
  757.     bge    waitmessage
  758.     add.l    #32,d7        ;increase period of voice 1
  759.     bra    modifper1
  760. perdn1:
  761.     clr.b    playflag
  762.     move.l    period1,d7
  763.     cmp.l    #256,d7
  764.     bls    waitmessage
  765.     sub.l    #32,d7        ;decrease period of voice 1
  766. modifper1:
  767.     bsr    playperiod    ;play new period
  768.     lea    gdgper1,a3
  769.     lea    period1t,a5
  770.     lea    period1,a4
  771.     bsr    modifyperiod    ;display new period
  772.     bra    waitbutton
  773. perup2:
  774.     move.b    #1,playflag
  775.     move.l    period2,d7
  776.     cmp.l    #32768,d7
  777.     bge    waitmessage
  778.     add.l    #32,d7        ;increase period of voice 2
  779.     bra    modifper2
  780. perdn2:
  781.     move.b    #1,playflag
  782.     move.l    period2,d7
  783.     cmp.l    #256,d7
  784.     bls    waitmessage
  785.     sub.l    #32,d7        ;decrease period of voice 2
  786. modifper2:
  787.     bsr    playperiod
  788.     lea    gdgper2,a3
  789.     lea    period2t,a5
  790.     lea    period2,a4
  791.     bsr    modifyperiod    ;and so on...
  792.     bra    waitbutton
  793. perup3:
  794.     move.b    #2,playflag
  795.     move.l    period3,d7
  796.     cmp.l    #32768,d7
  797.     bge    waitmessage
  798.     add.l    #32,d7
  799.     bra    modifper3
  800. perdn3:
  801.     move.b    #2,playflag
  802.     move.l    period3,d7
  803.     cmp.l    #256,d7
  804.     bls    waitmessage
  805.     sub.l    #32,d7
  806. modifper3:
  807.     bsr    playperiod
  808.     lea    gdgper3,a3
  809.     lea    period3t,a5
  810.     lea    period3,a4
  811.     bsr    modifyperiod
  812.     bra    waitbutton
  813. perup4:
  814.     move.b    #3,playflag
  815.     move.l    period4,d7
  816.     cmp.l    #32768,d7
  817.     bge    waitmessage
  818.     add.l    #32,d7
  819.     bra    modifper4
  820. perdn4:
  821.     move.b    #3,playflag
  822.     move.l    period4,d7
  823.     cmp.l    #256,d7
  824.     bls    waitmessage
  825.     sub.l    #32,d7
  826. modifper4:
  827.     bsr    playperiod
  828.     lea    gdgper4,a3
  829.     lea    period4t,a5
  830.     lea    period4,a4
  831.     bsr    modifyperiod
  832.  
  833. ; increaseing/decreasing period until the mousebutton is released
  834.  
  835. waitbutton:
  836.     move.l    4,a6
  837.     move.l    wdwhandle,a0
  838.     move.l    86(a0),a0    ;window user-port
  839.     jsr    GetMsg(a6)    ;get intuimessage
  840.     tst.l    d0
  841.     beq    waitdown    ;no message... go on changeing the period
  842.     move.l    d0,a1
  843.     move.l    20(a1),d6    ;get idcmp-code of event
  844.     jsr    ReplyMsg(a6)    ;and reply message
  845.     cmp.l    #$8,d6
  846.     beq    waitmessage    ;if the button was released, we are ready
  847.     bra    waitdown
  848.  
  849. ; set period for requested voice
  850.  
  851. playperiod:
  852.     moveq    #0,d4
  853.     move.b    playflag,d4
  854.     asl.w    #4,d4
  855.     move.l    #$dff0a0,a4
  856.     adda.l    d4,a4
  857.     move.l    #3579546,d0
  858.     move.l    d7,d1
  859.     divu    d1,d0
  860.     move.w    d0,audxper(a4)
  861.     rts
  862.  
  863. ; quit this wonderfull program ...
  864.  
  865. quitplthear:
  866.     move.w    #0,aud0vol
  867.     move.w    #0,aud1vol    ;clear all volumes and
  868.     move.w    #0,aud2vol
  869.     move.w    #0,aud3vol
  870.     move.w    #15,dmacon    ;stop all audio-dma
  871.     move.l    intuibase,a6
  872.     tst.l    wdwhandle
  873.     beq    nowdwclose    ;close the PLTHear-window
  874.     move.l    wdwhandle,a0
  875.     jsr    CloseWindow(a6)
  876. nowdwclose:    
  877.     move.l    4,a6
  878.     lea    mem,a2        ;pointer to memory-handles
  879.     lea    long,a3        ;pointer to sound-lengths
  880.     moveq    #3,d3        ;4 sounds to drop
  881. dropsmems:
  882.     move.l    (a2)+,a1    ;read next adress
  883.     move.l    (a3)+,d0    ;read next length
  884.     beq    dropnextmem    ;length = 0 ... no memory
  885.     jsr    FreeMem(a6)    ;free memory
  886. dropnextmem:
  887.     dbra    d3,dropsmems    ;go on freeing memory
  888.     tst.l    dosbase
  889.     beq    nodropdos
  890.     move.l    dosbase,a1
  891.     jsr    CloseLibrary(a6)    ;close dos_lib
  892. nodropdos:
  893.     tst.l    graphbase
  894.     beq    nodropgraph
  895.     move.l    graphbase,a1
  896.     jsr    CloseLibrary(a6)    ;close graph_lib
  897. nodropgraph:
  898.     tst.l    intuibase
  899.     beq    nodropintui
  900.     move.l    intuibase,a1
  901.     jsr    CloseLibrary(a6)    ;close intui_lib
  902. nodropintui:
  903.     tst.l    infomem
  904.     beq    nodropinfomem
  905.     move.l    #1024,d0
  906.     move.l    infomem,a1
  907.     jsr    FreeMem(a6)    ;drop infomem
  908. nodropinfomem:
  909.     tst.l    startmsg
  910.     beq    quitplthearprog
  911.     move.l    startmsg,a1    ;reply wb-start-message
  912.     jsr    ReplyMsg(a6)
  913. quitplthearprog:
  914.     moveq    #0,d0
  915.     moveq    #0,d1
  916.     move.l    startsp,sp
  917.     rts            ;and ... that's the end of plthear
  918.  
  919. ; loadfile-routine, gets length of file, allocates mem and finally loads it
  920.  
  921. loadfile:
  922.     movem.l    d1-d7/a1-a6,-(sp)
  923.     move.l    a0,a5        ;keep pointer to filename
  924.     move.l    d0,d5        ;keep mem-type
  925.     move.l    dosbase,a6
  926.     move.l    a5,d1
  927.     moveq    #-2,d2        ;lock-mode = -2 ... read !
  928.     jsr    Lock(a6)    ;get filelock
  929.     move.l    d0,d7        ;keep pointer to filelock
  930.     beq    lerror1        ;no lock ... error !
  931.     move.l    dosbase,a6
  932.     move.l    d7,d1        ;filelock
  933.     move.l    infomem,d2    ;info-memory
  934.     jsr    Examine(a6)    ;examine file-info-data
  935.     tst.l    d0        ;d0 = 0 ? ... Error !
  936.     beq    lerror1
  937.     move.l    d7,d1        ;drop filelock
  938.     jsr    UnLock(a6)
  939.     move.l    infomem,a3
  940.     move.l    124(a3),d0    ;get length of file
  941.     addq.l    #2,d0        ;we want some zero-bytes at the end
  942.     move.l    4,a6
  943.     move.l    d5,d1        ;get requested mem-type
  944.     jsr    AllocMem(a6)    ;allocate memory
  945.     move.l    d0,a2        ;keep memory-pointer
  946.     tst.l    d0        ;no memory ... error !
  947.     beq    lerror1
  948.     move.l    a5,d1        ;filename-pointer
  949.     move.l    #1005,d2    ;open-mode: old
  950.     move.l    dosbase,a6
  951.     jsr    Open(a6)    ;open file
  952.     move.l    d0,d4        ;keep filehandle
  953.     beq    lerror1        ;filehandle = 0 ? ... error !
  954.     move.l    d0,d1
  955.     move.l    a2,d2        ;memory-pointer
  956.     move.l    124(a3),d3    ;length of file
  957.     jsr    Read(a6)    ;read file
  958.     move.l    d4,d1
  959.     jsr    Close(a6)    ;close file
  960.     move.l    124(a3),d4    ;keep length of file
  961.     addq.l    #2,d4        ;we still want some zero-bytes at the end
  962.     move.l    a2,a0        ;data-pointer in a0
  963.     move.l    d4,d0        ;length of data in d0
  964. exitloadfile:
  965.     movem.l    (sp)+,d1-d7/a1-a6
  966.     rts            ;we are ready !
  967. lerror1:
  968.     moveq    #0,d0        ;d0 = 0 ... that means one error
  969.     bra    exitloadfile    ;and we are ready too !
  970.  
  971. ; get ascii out of integer (textpointer => a0, inter => d0)
  972.  
  973. getascii:
  974.     moveq    #16,d1
  975.     divu    #10000,d0
  976.     addi.b    #48,d0
  977.     move.b    d0,(a0)
  978.     lsr.l    d1,d0        ;into ASCII-text
  979.     divu    #1000,d0
  980.     addi.b    #48,d0
  981.     move.b    d0,1(a0)
  982.     lsr.l    d1,d0
  983.     divu    #100,d0
  984.     addi.b    #48,d0
  985.     move.b    d0,2(a0)
  986.     lsr.l    d1,d0
  987.     divu    #10,d0
  988.     addi.b    #48,d0
  989.     move.b    d0,3(a0)
  990.     lsr.l    d1,d0
  991.     addi.b    #48,d0
  992.     move.b    d0,4(a0)
  993.     rts
  994.  
  995. ; display the wonderfull plthear-help-window
  996.  
  997. plthelp:
  998.     move.l    intuibase,a6
  999.     lea    wabout,a0    ;open help-window
  1000.     jsr    OpenWindow(a6)
  1001.     move.l    d0,d7        ;keep wdwhandle
  1002.     beq    quitplthelp    ;no window ! ... that's unbeliveable
  1003.     move.l    graphbase,a6
  1004.     move.l    d7,a1
  1005.     move.l    50(a1),a1
  1006.     moveq    #2,d0        ;set pen to color 2
  1007.     jsr    SetAPen(a6)
  1008.     move.l    d7,a1
  1009.     move.l    50(a1),a1
  1010.     moveq    #2,d0        ;rect allmost the whole window
  1011.     moveq    #1,d1
  1012.     move.w    #537,d2
  1013.     move.w    #188,d3
  1014.     jsr    RectFill(a6)
  1015.     move.l    intuibase,a6
  1016.     moveq    #5,d3        ;y-pos of first line
  1017.     lea    helptx,a5    ;pointer to help-lines
  1018.     moveq    #19,d5        ;20 lines to print
  1019. plthelploop1:
  1020.     lea    texttext,a4    ;memory for text-line
  1021.     moveq    #-1,d6        ;counter for length to pre-zero
  1022. plthelploop2:
  1023.     addq.w    #1,d6        ;count one more character
  1024.     move.b    (a5)+,(a4)+    ;copy it
  1025.     bne    plthelploop2    ;not zero ... go on copying
  1026.     asl.w    #3,d6        ;8 points per char 
  1027.     move.w    #540,d0        ;width of window
  1028.     sub.w    d6,d0        ;sub width of text
  1029.     lsr.w    #1,d0        ;and divide through 2 to center
  1030.     move.l    d7,a0
  1031.     move.l    50(a0),a0    ;window-rastport
  1032.     lea    textline,a1    ;text-struct
  1033.     move.b    #2,1(a1)    ;set background-color to color 2
  1034.     move.l    d3,d1        ;get y-pos
  1035.     jsr    PrintIText(a6)    ;and print the line
  1036.     add.w    #9,d3        ;add 9 to y-pos
  1037.     dbra    d5,plthelploop1    ;and go on printing
  1038.     lea    textline,a1    ;as the same text-struct is used to display
  1039.     clr.b    1(a1)        ;the 'real' text reset back-col to 0
  1040.     bclr    #2,pltflag    ;clear flag (see below for the sense of it)
  1041. plthelpwait:
  1042.     move.l    4,a6
  1043.     move.l    d7,a0
  1044.     move.l    86(a0),a0    ;window-user-port
  1045.     jsr    WaitPort(a6)    ;wait for message ... task is sleeping
  1046.     move.l    d7,a0
  1047.     move.l    86(a0),a0
  1048.     jsr    GetMsg(a6)    ;now ... there's one user-request !
  1049.     tst.l    d0
  1050.     beq    plthelpwait    ;no ...there's none ... (...strange!)
  1051.     move.l    d0,a1
  1052.     move.l    20(a1),d6    ;get idcmp of message-cause
  1053.     jsr    ReplyMsg(a6)    ;and send message back
  1054.     cmp.l    #$8,d6        ;did the user (got bless him/her)
  1055.     beq    helpmousepick    ;press one mouse-button ?
  1056.     btst    #2,pltflag    ;drop the first key, which possibly opened
  1057.     bne    helpmousepick    ;the window (a strange way to avoid that
  1058.     bset    #2,pltflag    ;the window is closed at once if it was
  1059.     bra    plthelpwait    ;called with the help-key)
  1060. helpmousepick:
  1061.     move.l    intuibase,a6
  1062.     move.l    d7,a0
  1063.     jsr    CloseWindow(a6)
  1064. quitplthelp:
  1065.     rts
  1066.  
  1067. ; display the wonderfull plthear-window
  1068.  
  1069. dowindow:
  1070.     lea    fields,a5    ;table of rects
  1071.     moveq    #40,d7        ;number of rects -1
  1072.     move.l    wdwrast,dorast
  1073.     bsr    dofields
  1074.     lea    texte,a5    ;table of texts
  1075.     moveq    #17,d7        ;number of texts -1
  1076.     bsr    dotexts
  1077.     move.l    intuibase,a6
  1078.     lea    gdgquit,a0
  1079.     move.l    wdwhandle,a1
  1080.     move.l    #0,a2        ;now we redraw the (text-) gadgets
  1081.     jsr    RefreshGadgets(a6)
  1082.     rts
  1083.  
  1084. ; variables, texts, names, flags, handles, pointers and so on ...
  1085.  
  1086. dosname:    dc.b    "dos.library",0
  1087.         even
  1088. intuiname:    dc.b    "intuition.library",0
  1089.         even
  1090. graphname:    dc.b    "graphics.library",0
  1091.         even
  1092. dosbase:    dc.l    0
  1093. intuibase:    dc.l    0
  1094. graphbase:    dc.l    0
  1095. infomem:    dc.l    0
  1096. wdwhandle:    dc.l    0    ;windowhandle
  1097. wdwrast:    dc.l    0    ;windowrastport
  1098. dorast:        dc.l    0
  1099. thistask:    dc.l    0    ;pointer to task struct
  1100. startsp:    dc.l    0    ;stackpointer when programm is started
  1101. startmsg:    dc.l    0    ;wb-startup-message-handle
  1102. mem:        ds.l    4    ;adresses of the sounds
  1103. long:        ds.l    4    ;lengths of the sounds
  1104. memo1:        dc.l    0    ;one longword to keep s.th. in
  1105. memo2:        dc.w    0    ;one word to keep s.th. in
  1106. doper:        dc.l    0
  1107. slength:    dc.w    0
  1108. fieldheight:    dc.w    0    ;height of rect to draw
  1109. pltflag:    dc.b    0    ;one byte to keep s.th. in
  1110. playflag:    dc.b    0
  1111. time:        dc.b    0
  1112. param:        dc.b    0
  1113.         even
  1114.  
  1115. ;table of dimensions of the rectangles that make the window-look
  1116.  
  1117. fields:    dc.w    2,10,636,95,2
  1118. lofi1:    dc.w    71,14,167,10,0
  1119. lofi2:    dc.w    71,34,167,10,0
  1120. lofi3:    dc.w    71,54,167,10,0
  1121. lofi4:    dc.w    71,74,167,10,0
  1122.     dc.w    250,14,43,10,2
  1123.     dc.w    250,34,43,10,2
  1124.     dc.w    250,54,43,10,2
  1125.     dc.w    250,74,43,10,2
  1126. ofi1:    dc.w    299,14,43,10,2
  1127. ofi2:    dc.w    299,34,43,10,2
  1128. ofi3:    dc.w    299,54,43,10,2
  1129. ofi4:    dc.w    299,74,43,10,2
  1130. cofi1:    dc.w    347,14,43,10,2
  1131. cofi2:    dc.w    347,34,43,10,2
  1132. cofi3:    dc.w    347,54,43,10,2
  1133. cofi4:    dc.w    347,74,43,10,2
  1134.     dc.w    395,14,43,10,2
  1135.     dc.w    395,34,43,10,2
  1136.     dc.w    395,54,43,10,2
  1137.     dc.w    395,74,43,10,2
  1138.     dc.w    443,14,43,10,2
  1139.     dc.w    443,34,43,10,2
  1140.     dc.w    443,54,43,10,2
  1141.     dc.w    443,74,43,10,2
  1142.     dc.w    491,14,59,10,0
  1143.     dc.w    491,34,59,10,0
  1144.     dc.w    491,54,59,10,0
  1145.     dc.w    491,74,59,10,0
  1146.     dc.w    469,93,43,10,2
  1147.     dc.w    518,93,43,10,2
  1148.     dc.w    554,14,21,10,2
  1149.     dc.w    554,34,21,10,2
  1150.     dc.w    554,54,21,10,2
  1151.     dc.w    554,74,21,10,2
  1152.     dc.w    578,14,21,10,2
  1153.     dc.w    578,34,21,10,2
  1154.     dc.w    578,54,21,10,2
  1155.     dc.w    578,74,21,10,2
  1156.     dc.w    71,93,24,10,2
  1157.     dc.w    103,93,32,10,2
  1158.  
  1159. ;table of texts and their positions that make the window-look
  1160.  
  1161. texte:    dc.w    12,16
  1162.     dc.l    tx1
  1163.     dc.w    12,36
  1164.     dc.l    tx2
  1165.     dc.w    12,56
  1166.     dc.l    tx3
  1167.     dc.w    12,76
  1168.     dc.l    tx4
  1169.     dc.w    256,16
  1170.     dc.l    tx5
  1171.     dc.w    256,36
  1172.     dc.l    tx5
  1173.     dc.w    256,56
  1174.     dc.l    tx5
  1175.     dc.w    256,76
  1176.     dc.l    tx5
  1177.     dc.w    476,95
  1178.     dc.l    tx6
  1179.     dc.w    557,16
  1180.     dc.l    tx7
  1181.     dc.w    557,36
  1182.     dc.l    tx7
  1183.     dc.w    557,56
  1184.     dc.l    tx7
  1185.     dc.w    557,76
  1186.     dc.l    tx7
  1187.     dc.w    11,95
  1188.     dc.l    tx8
  1189.     dc.w    604,16
  1190.     dc.l    typ1
  1191.     dc.w    604,36
  1192.     dc.l    typ2
  1193.     dc.w    604,56
  1194.     dc.l    typ3
  1195.     dc.w    604,76
  1196.     dc.l    typ4
  1197.  
  1198. tx1:    dc.b    "VOICE 1",0
  1199.     even
  1200. tx2:    dc.b    "VOICE 2",0
  1201.     even
  1202. tx3:    dc.b    "VOICE 3",0
  1203.     even
  1204. tx4:    dc.b    "VOICE 4",0
  1205.     even
  1206. tx5:    dc.b    "LOAD  ONCE  CONT  STOP  RATE",0
  1207.     even
  1208. tx6:    dc.b    "HELP  QUIT",0
  1209.     even
  1210. tx7:    dc.b    "UP DN",0
  1211.     even
  1212. tx8:    dc.b    "FILTER  ON  OFF",0
  1213.     even
  1214. typ1:    dc.l    0
  1215. typ2:    dc.l    0
  1216. typ3:    dc.l    0
  1217. typ4:    dc.l    0
  1218.  
  1219. ;help-message
  1220.  
  1221. helptx:
  1222.  dc.b    "-----===== Platinum-Hear-Replacement - PLTHear =====-----",0
  1223.  dc.b    " ",0
  1224.  dc.b    "© 1991 by Joerg Schliesser / Platinum Softwareline",0
  1225.  dc.b    "Rotenwaldstrasse 20 / D-7000 Stuttgart 1 / Germany",0
  1226.  dc.b    "PLTHear is freely distributable. (Only on disks,",0
  1227.  dc.b    "distributed in a non-commercial sense) Refer to PLTTools.doc.",0
  1228.  dc.b    "As long as this text remains unchanged",0
  1229.  dc.b    " ",0
  1230.  dc.b    "PLTHear keyboard command summary:",0
  1231.  dc.b    "Load voice 1 .... Shift & F1   Load voice 2 .... Shift & F2",0
  1232.  dc.b    "Load voice 3 .... Shift & F3   Load voice 4 .... Shift & F4",0
  1233.  dc.b    "Play voice 1 ............ F1   Play voice 2 ............ F2",0
  1234.  dc.b    "Play voice 3 ............ F3   Play voice 4 ............ F4",0
  1235.  dc.b    "Repeat voice 1 ........... 1   Repeat voice 2 ........... 2",0
  1236.  dc.b    "Repeat voice 3 ........... 3   Repeat voice 4 ........... 4",0
  1237.  dc.b    "Stop voice 1 ..... Shift & 1   Stop voice 2 ..... Shift & 2",0
  1238.  dc.b    "Stop voice 3 ..... Shift & 3   Stop voice 4 ..... Shift & 4",0
  1239.  dc.b    "Hardware-Filter On ....... +   Hardware-Filter Off ...... -",0
  1240.  dc.b    "Quit PLTHear .......................................... Esc",0
  1241.  dc.b    "To close this window press any key or mouse button",0
  1242.     even
  1243.  
  1244. textline:
  1245.     dc.b    1,0,1
  1246.     even
  1247.     dc.l    0,0,texttext,0
  1248. texttext:    ds.b    80
  1249.  
  1250. txtext:        dc.b    1,0,0
  1251.         even
  1252.         dc.l    0,0
  1253. txtextpoint:    dc.l    0,0
  1254.  
  1255. ;window-structs
  1256.  
  1257. wplt:
  1258.     dc.w    0,24,640,107    ;x,y,w,h
  1259.     dc.b    2,1        ;colors
  1260.     dc.l    $468        ;idcmp,rawkey,upgadget,dngadget,mousebutton
  1261.     dc.l    $2011006    ;activ,rmbtrap,front/back,drag
  1262.     dc.l    gdgquit,0,wplttitle,0,0
  1263.     dc.w    0,0,0,0
  1264.     dc.w    1
  1265. wplttitle:
  1266.  dc.b "PLTHear V1.0 © 1991 by Joerg Schliesser / Platinum Softwareline",0
  1267.     even
  1268.  
  1269. wabout:
  1270.     dc.w    49,5,540,190    ;x,y,w,h
  1271.     dc.b    2,1        ;colors
  1272.     dc.l    $408        ;idcmp,rawkey,mousebuttons
  1273.     dc.l    $2011000    ;activ,rmbtrap,borderless
  1274.     dc.l    0,0,0,0,0,0,0
  1275.     dc.w    1
  1276.  
  1277. ; gadget structs
  1278.  
  1279. gdgquit:
  1280.     dc.l    gdghelp
  1281.     dc.w    518,93,44,11,0,1,1
  1282.     dc.l    0,0,0,0,0
  1283.     dc.w    1
  1284.     dc.l    0
  1285. gdghelp:
  1286.     dc.l    gdgload1
  1287.     dc.w    469,93,44,11,0,1,1
  1288.     dc.l    0,0,0,0,0
  1289.     dc.w    2
  1290.     dc.l    0
  1291. gdgload1:
  1292.     dc.l    gdgload2
  1293.     dc.w    250,14,44,11,0,1,1
  1294.     dc.l    0,0,0,0,0
  1295.     dc.w    3
  1296.     dc.l    0
  1297. gdgload2:
  1298.     dc.l    gdgload3
  1299.     dc.w    250,34,44,11,0,1,1
  1300.     dc.l    0,0,0,0,0
  1301.     dc.w    4
  1302.     dc.l    0
  1303. gdgload3:
  1304.     dc.l    gdgload4
  1305.     dc.w    250,54,44,11,0,1,1
  1306.     dc.l    0,0,0,0,0
  1307.     dc.w    5
  1308.     dc.l    0
  1309. gdgload4:
  1310.     dc.l    gdgonce1
  1311.     dc.w    250,74,44,11,0,1,1
  1312.     dc.l    0,0,0,0,0
  1313.     dc.w    6
  1314.     dc.l    0
  1315. gdgonce1:
  1316.     dc.l    gdgonce2
  1317.     dc.w    299,14,44,11,0,1,1
  1318.     dc.l    0,0,0,0,0
  1319.     dc.w    7
  1320.     dc.l    0
  1321. gdgonce2:
  1322.     dc.l    gdgonce3
  1323.     dc.w    299,34,44,11,0,1,1
  1324.     dc.l    0,0,0,0,0
  1325.     dc.w    8
  1326.     dc.l    0
  1327. gdgonce3:
  1328.     dc.l    gdgonce4
  1329.     dc.w    299,54,44,11,0,1,1
  1330.     dc.l    0,0,0,0,0
  1331.     dc.w    9
  1332.     dc.l    0
  1333. gdgonce4:
  1334.     dc.l    gdgrep1
  1335.     dc.w    299,74,44,11,0,1,1
  1336.     dc.l    0,0,0,0,0
  1337.     dc.w    10
  1338.     dc.l    0
  1339. gdgrep1:
  1340.     dc.l    gdgrep2
  1341.     dc.w    347,14,44,11,0,1,1
  1342.     dc.l    0,0,0,0,0
  1343.     dc.w    11
  1344.     dc.l    0
  1345. gdgrep2:
  1346.     dc.l    gdgrep3
  1347.     dc.w    347,34,44,11,0,1,1
  1348.     dc.l    0,0,0,0,0
  1349.     dc.w    12
  1350.     dc.l    0
  1351. gdgrep3:
  1352.     dc.l    gdgrep4
  1353.     dc.w    347,54,44,11,0,1,1
  1354.     dc.l    0,0,0,0,0
  1355.     dc.w    13
  1356.     dc.l    0
  1357. gdgrep4:
  1358.     dc.l    gdgstop1
  1359.     dc.w    347,74,44,11,0,1,1
  1360.     dc.l    0,0,0,0,0
  1361.     dc.w    14
  1362.     dc.l    0
  1363. gdgstop1:
  1364.     dc.l    gdgstop2
  1365.     dc.w    395,14,44,11,0,1,1
  1366.     dc.l    0,0,0,0,0
  1367.     dc.w    15
  1368.     dc.l    0
  1369. gdgstop2:
  1370.     dc.l    gdgstop3
  1371.     dc.w    395,34,44,11,0,1,1
  1372.     dc.l    0,0,0,0,0
  1373.     dc.w    16
  1374.     dc.l    0
  1375. gdgstop3:
  1376.     dc.l    gdgstop4
  1377.     dc.w    395,54,44,11,0,1,1
  1378.     dc.l    0,0,0,0,0
  1379.     dc.w    17
  1380.     dc.l    0
  1381. gdgstop4:
  1382.     dc.l    gdgper1
  1383.     dc.w    395,74,44,11,0,1,1
  1384.     dc.l    0,0,0,0,0
  1385.     dc.w    18
  1386.     dc.l    0
  1387. gdgper1:
  1388.     dc.l    gdgper2
  1389.     dc.w    494,16,48,8,0,$802,4
  1390.     dc.l    0,0,0,0,per1info
  1391.     dc.w    19
  1392.     dc.l    0
  1393. per1info:
  1394.     dc.l    period1t,0
  1395.     dc.w    0,6,0,0,0,0,0,0
  1396.     dc.l    0
  1397. period1:    dc.l    8363,0
  1398. period1t:
  1399.     dc.b    "08363",0,0,0
  1400. gdgper2:
  1401.     dc.l    gdgper3
  1402.     dc.w    494,36,48,8,0,$802,4
  1403.     dc.l    0,0,0,0,per2info
  1404.     dc.w    20
  1405.     dc.l    0
  1406. per2info:
  1407.     dc.l    period2t,0
  1408.     dc.w    0,6,0,0,0,0,0,0
  1409.     dc.l    0
  1410. period2:    dc.l    8363,0
  1411. period2t:
  1412.     dc.b    "08363",0,0,0
  1413. gdgper3:
  1414.     dc.l    gdgper4
  1415.     dc.w    494,56,48,8,0,$802,4
  1416.     dc.l    0,0,0,0,per3info
  1417.     dc.w    21
  1418.     dc.l    0
  1419. per3info:
  1420.     dc.l    period3t,0
  1421.     dc.w    0,6,0,0,0,0,0,0
  1422.     dc.l    0
  1423. period3:    dc.l    8363,0
  1424. period3t:
  1425.     dc.b    "08363",0,0,0
  1426. gdgper4:
  1427.     dc.l    gdgup1
  1428.     dc.w    494,76,48,8,0,$802,4
  1429.     dc.l    0,0,0,0,per4info
  1430.     dc.w    22
  1431.     dc.l    0
  1432. per4info:
  1433.     dc.l    period4t,0
  1434.     dc.w    0,6,0,0,0,0,0,0
  1435.     dc.l    0
  1436. period4:    dc.l    8363,0
  1437. period4t:
  1438.     dc.b    "08363",0,0,0
  1439. gdgup1:
  1440.     dc.l    gdgup2
  1441.     dc.w    554,14,22,11,0,2,1
  1442.     dc.l    0,0,0,0,0
  1443.     dc.w    23
  1444.     dc.l    0
  1445. gdgup2:
  1446.     dc.l    gdgup3
  1447.     dc.w    554,34,22,11,0,2,1
  1448.     dc.l    0,0,0,0,0
  1449.     dc.w    24
  1450.     dc.l    0
  1451. gdgup3:
  1452.     dc.l    gdgup4
  1453.     dc.w    554,54,22,11,0,2,1
  1454.     dc.l    0,0,0,0,0
  1455.     dc.w    25
  1456.     dc.l    0
  1457. gdgup4:
  1458.     dc.l    gdgdn1
  1459.     dc.w    554,74,22,11,0,2,1
  1460.     dc.l    0,0,0,0,0
  1461.     dc.w    26
  1462.     dc.l    0
  1463. gdgdn1:
  1464.     dc.l    gdgdn2
  1465.     dc.w    578,14,22,11,0,2,1
  1466.     dc.l    0,0,0,0,0
  1467.     dc.w    27
  1468.     dc.l    0
  1469. gdgdn2:
  1470.     dc.l    gdgdn3
  1471.     dc.w    578,34,22,11,0,2,1
  1472.     dc.l    0,0,0,0,0
  1473.     dc.w    28
  1474.     dc.l    0
  1475. gdgdn3:
  1476.     dc.l    gdgdn4
  1477.     dc.w    578,54,22,11,0,2,1
  1478.     dc.l    0,0,0,0,0
  1479.     dc.w    29
  1480.     dc.l    0
  1481. gdgdn4:
  1482.     dc.l    gdgfon
  1483.     dc.w    578,74,22,11,0,2,1
  1484.     dc.l    0,0,0,0,0
  1485.     dc.w    30
  1486.     dc.l    0
  1487. gdgfon:
  1488.     dc.l    gdgfoff
  1489.     dc.w    71,93,25,11,0,1,1
  1490.     dc.l    0,0,0,0,0
  1491.     dc.w    31
  1492.     dc.l    0
  1493. gdgfoff:
  1494.     dc.l    filename1gdg
  1495.     dc.w    103,93,33,11,0,1,1
  1496.     dc.l    0,0,0,0,0
  1497.     dc.w    32
  1498.     dc.l    0
  1499. filename1gdg:
  1500.     dc.l    filename2gdg
  1501.     dc.w    75,16,160,8,0,2,4
  1502.     dc.l    0,0,0,0,filename1gdginfo
  1503.     dc.w    33
  1504.     dc.l    0
  1505. filename1gdginfo:
  1506.     dc.l    filename1,0
  1507.     dc.w    0,80,0,0,0,0,0,0
  1508.     dc.l    0,0,0
  1509. filename1:
  1510.     ds.b    82
  1511. filename2gdg:
  1512.     dc.l    filename3gdg
  1513.     dc.w    75,36,160,8,0,2,4
  1514.     dc.l    0,0,0,0,filename2gdginfo
  1515.     dc.w    34
  1516.     dc.l    0
  1517. filename2gdginfo:
  1518.     dc.l    filename2,0
  1519.     dc.w    0,80,0,0,0,0,0,0
  1520.     dc.l    0,0,0
  1521. filename2:
  1522.     ds.b    82
  1523. filename3gdg:
  1524.     dc.l    filename4gdg
  1525.     dc.w    75,56,160,8,0,2,4
  1526.     dc.l    0,0,0,0,filename3gdginfo
  1527.     dc.w    35
  1528.     dc.l    0
  1529. filename3gdginfo:
  1530.     dc.l    filename3,0
  1531.     dc.w    0,80,0,0,0,0,0,0
  1532.     dc.l    0,0,0
  1533. filename3:
  1534.     ds.b    82
  1535. filename4gdg:
  1536.     dc.l    0
  1537.     dc.w    75,76,160,8,0,2,4
  1538.     dc.l    0,0,0,0,filename4gdginfo
  1539.     dc.w    36
  1540.     dc.l    0
  1541. filename4gdginfo:
  1542.     dc.l    filename4,0
  1543.     dc.w    0,80,0,0,0,0,0,0
  1544.     dc.l    0,0,0
  1545. filename4:
  1546.     ds.b    82
  1547.  
  1548. ; display rendered fields (field-table => a5, number of fields => d7)
  1549.  
  1550. dofields:
  1551.     move.l    graphbase,a6
  1552. fielding:
  1553.     move.w    (a5)+,d4    ;x-pos
  1554.     move.w    (a5)+,d5    ;y-pos
  1555.     move.w    (a5)+,d6    ;width of field
  1556.     move.w    (a5)+,fieldheight    ;height of field
  1557.     move.l    dorast,a1    ;get rastport
  1558.     moveq    #1,d0
  1559.     jsr    SetAPen(a6)    ;set color for outline
  1560.     move.l    dorast,a1
  1561.     move.w    d4,d0
  1562.     move.w    d5,d1
  1563.     move.w    d4,d2
  1564.     move.w    d5,d3
  1565.     add.w    d6,d2
  1566.     add.w    fieldheight,d3
  1567.     jsr    RectFill(a6)    ;draw outline of field
  1568.     move.l    dorast,a1
  1569.     move.w    (a5)+,d0
  1570.     jsr    SetAPen(a6)    ;set color for field
  1571.     move.l    dorast,a1
  1572.     move.w    d4,d0
  1573.     move.w    d5,d1
  1574.     move.w    d4,d2
  1575.     move.w    d5,d3
  1576.     add.w    #2,d0
  1577.     add.w    #1,d1
  1578.     add.w    d6,d2
  1579.     add.w    fieldheight,d3
  1580.     sub.w    #2,d2
  1581.     sub.w    #1,d3        ;draw field
  1582.     jsr    RectFill(a6)
  1583.     dbra    d7,fielding    ;go on...
  1584.     rts            
  1585.  
  1586. ; print some texts (table of texts => a5, number of texts => d7)
  1587.  
  1588. dotexts:
  1589.     move.l    intuibase,a6
  1590. texting:
  1591.     move.l    dorast,a0    ;get rastport
  1592.     lea    txtext,a1
  1593.     move.w    (a5)+,d0    ;get x-pos
  1594.     move.w    (a5)+,d1    ;get y-pos
  1595.     move.l    (a5)+,txtextpoint    ;pointer to ascii-text
  1596.     jsr    PrintIText(a6)    ;print it ...
  1597.     dbra    d7,texting
  1598.     rts
  1599.  
  1600. ;change window-pointer to sleeping
  1601.  
  1602. pltworkon:
  1603.     move.l    wdwhandle,a0
  1604.     move.l    intuibase,a6
  1605.     lea    sleeppoint,a1
  1606.     moveq    #16,d1
  1607.     moveq    #9,d0
  1608.     moveq    #0,d2
  1609.     moveq    #0,d3
  1610.     jsr    SetPointer(a6)
  1611.     rts
  1612.  
  1613. ;change window-pointer to normal pointer
  1614.  
  1615. pltworkoff:
  1616.     move.l    wdwhandle,a0
  1617.     move.l    intuibase,a6
  1618.     jsr    ClearPointer(a6)
  1619.     rts
  1620.  
  1621.     section    pltdaten,data_c        ;section 2, daten, chipmem
  1622.  
  1623. sleeppoint:
  1624.     dc.l    0
  1625.     dc.l    %00000000000000000001000100010000
  1626.     dc.l    %00010001000100000010101010101000
  1627.     dc.l    %00100010001000000101010101010000
  1628.     dc.l    %01000100010000001010101010100000
  1629.     dc.l    %11101110111000000001000100010000
  1630.     dc.l    %01000100010000001011101110100000
  1631.     dc.l    %01000100010000001010101010110101
  1632.     dc.l    %01000100010101011010101010101010
  1633.     dc.l    %00000000000000000100010001010101
  1634.     dc.l    0
  1635.  
  1636. notone:    dc.l    0
  1637.  
  1638.  END
  1639.  
  1640.